import{$ as e,Ft as t,Ht as n,Yt as r,_ as i,b as a,ct as o,et as s,k as c,mt as l,qt as u,tt as d,v as f,vn as p,w as m,xt as h}from"./CIxmKYxc4tZcJF.js";import{x as g}from"./DWlEJV-j33On0I.js";import"./AuTu7hII1ERTdj.js";import{t as _}from"./DJeJfhW-4iv1Az.js";import{t as v}from"./Br8DQTtj1W9Iu5.js";var y=[`id`],b=[`id`],x=c({inheritAttrs:!1,__name:`oui-textarea`,props:e({title:{},description:{},required:{type:Boolean},id:{},autosize:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},lazyDelay:{default:5e3},lazyMaxDelay:{default:6e4},disabled:{type:Boolean},plain:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let c=e,x=t(e,`modelValue`),S=p(``),C=v({lazy:()=>c.lazy,lazyDelay:()=>c.lazyDelay,lazyMaxDelay:()=>c.lazyMaxDelay,commit:()=>{x.value=S.value}});n(S,e=>{e!==(x.value??``)&&C.schedule()}),n(()=>x.value,e=>S.value=e??``,{immediate:!0});function w(){C.flush()}let T=p(null),E=p(null);function D(){let e=T.value,t=E.value;if(!e||!t)return;let n=t.offsetHeight;t.style.minHeight=`${n}px`,e.style.height=`0px`;let r=e.scrollHeight,i=Number.parseFloat(getComputedStyle(e).minHeight)||0;e.style.height=r>i?`${r+2}px`:``,t.style.minHeight=``}return c.autosize&&(n(S,()=>d(D),{flush:`post`}),o(()=>d(D))),(t,n)=>(l(),f(_,{id:e.id,title:e.title,description:e.description,required:e.required},m({default:u(()=>[c.autosize?(l(),a(`div`,{key:0,ref_key:`wrapper`,ref:E,class:`oui-textarea-autosize _oui-block-control`},[r(i(`textarea`,s({id:e.id},t.$attrs,{ref_key:`textarea`,ref:T,"onUpdate:modelValue":n[0]||=e=>S.value=e,class:e.plain?[`_plain`,`_autosize`]:[`oui-textarea`,`_autosize`],rows:`1`,onBlur:w}),null,16,y),[[g,S.value]])],512)):r((l(),a(`textarea`,s({key:1,id:e.id},t.$attrs,{ref_key:`textarea`,ref:T,"onUpdate:modelValue":n[1]||=e=>S.value=e,class:e.plain?`_plain`:`oui-textarea _oui-block-control`,rows:`6`,onBlur:w}),null,16,b)),[[g,S.value]])]),_:2},[t.$slots.title?{name:`title`,fn:u(()=>[h(t.$slots,`title`)]),key:`0`}:void 0,t.$slots.description?{name:`description`,fn:u(()=>[h(t.$slots,`description`)]),key:`1`}:void 0]),1032,[`id`,`title`,`description`,`required`]))}});export{x as t};